(function (){
    let btnPost1 = document.querySelector('#btn-post')
    btnPost1.addEventListener('click', function(){
        let nameInput = document.querySelector('#name')
        let emailInput = document.querySelector('#email')
        let topicInput = document.querySelector('#topic')
        let commentInput = document.querySelector('#comment')
        axios.post('http://81.70.162.221:3000/postMessage', {
            nickname: nameInput.value,
            email: emailInput.value, 
            title: topicInput.value, 
            content: commentInput.value,
          
        }).then(function(res){
          if(res.data == 'success'){
            console.log('1111');
            alert('提交成功');
            let arr = JSON.parse(res.config.data);
            console.log(arr);
            
          }
          
        });
      }, false)
})();